function $(v){
	return document.getElementById(v);
}
//格式化时间  格式为: 2010-05-07
function dateFormat(d){
	return d.getFullYear()+"-"+((d.getMonth()+1)>9 ? (d.getMonth()+1) : "0"+(d.getMonth()+1))+"-"+(d.getDate() > 9 ? d.getDate() : "0"+d.getDate());
}
//格式化时间  格式为: 2010-05-07 12:23:33
function df(d){
	var y = d.getFullYear();
	var mo = d.getMonth()+1;
	mo = mo > 9 ? mo : "0"+mo;
	var da = d.getDate();
	da = da > 9 ? da : "0"+da;
	var h = d.getHours();
	h = h >9 ? h : "0"+h;
	var mi = d.getMinutes();
	mi = mi >9 ? mi : "0"+mi;
	var s = d.getSeconds();
	s = s >9 ? s : "0"+s;
	return y+"-"+mo+"-"+da+" "+h+":"+mi+":"+s;	
}
//返回当前日期 
function getCdate(){
	return dateFormat(new Date());
}
function getWeek(){
	var d = new Date();
	var week = "";
	if (d.getDay() == 0) week="星期日";
	if (d.getDay() == 1) week="星期一";
	if (d.getDay() == 2) week="星期二";
	if (d.getDay() == 3) week="星期三";
	if (d.getDay() == 4) week="星期四";
	if (d.getDay() == 5) week="星期五";
	if (d.getDay() == 6) week="星期六";
	$("currentWeek").innerHTML = week;
}
//返回指定日期的前一天
function getLdate(date){
	var d = new Date(date);
	var l = d.getTime()-1000*60*60*24;
	return dateFormat(new Date(l));
}
//返回指定日期的后一天
function getNdate(date){
	var d = new Date(date);
	var l = d.getTime()+1000*60*60*24;
	return dateFormat(new Date(l));
}
function showDate(){
	showCtime();
	setInterval("showCtime()",1000);
	getWeek();
	$("conDate").value = getCdate();
	
}
function showLastDate(){
	$("conDate").value=getLdate($("conDate").value);
}
function showNextDate(){
	$("conDate").value=getNdate($("conDate").value);
}
function showCtime(){
	$("currentTime").innerHTML = df(new Date());
}